﻿//Copyright@<2009> <Naveen>

using System;
using System.Collections.Generic;

using System.Text;

namespace ProjectMain
{
    public static class AccountClass
    {

        public static void OpenNewAccount()
        {
            string username;
            string password;
            string firstname;
            string lastname;

            ClassGetUserInfo.getUserInfo(out username, out password);
            //using output variables, there could be a better way - Ask Ramesh

           do
            {
                Console.WriteLine();
                System.Console.Write("Enter First Name: \t");
                firstname = Console.ReadLine();
            } while (firstname == "");


            do
            {
                Console.WriteLine();
                System.Console.Write("Enter Last Name: \t");
                lastname = Console.ReadLine();
            } while (lastname == "");

            
            DBClass.DBConnAndUpdate(username, password, firstname, lastname);

        }


        public static void LoginAccount(out string username, out string firstname, out string lastname)
        {

           
            string password;
            

            ClassGetUserInfo.getUserInfo(out username, out password);
            
            //Set  Global User Name 
            ClassGlobalVar.GlobalVar = username;
            DBClass.DBConnAndGetData(username, password, out firstname, out lastname);

        }

    }
}
